// import React from 'react'
// import { useLocation } from 'react-router-dom'
// import qs from 'qs';

// export default function News() {

//   const location = useLocation()
//   const { user } = qs.parse(location.search.split('?')[1])

//   const newsList = location.state;
//   return (
//     <div>
//       <h1>News</h1>
//       <p>用户名是{user} 编号是：{ }</p>
//       {
//         newsList.map(item => {
//           return <li key={item.id}>{item.name}</li>
//         })
//       }
//     </div>
//   )
// }

import React from 'react'
import { useLocation } from 'react-router-dom';
import qs from 'qs'

export default function News() {
  const location = useLocation()
  console.log(location, "music.location");
  const { user } = qs.parse(location.search.split("?")[1])
  const newsList = location.state;
  return (
    <div>
      <h1>News</h1>
      <p>用户名是{user} 编号是：{ }</p>
      {
        newsList.map(item => {
          return <li key={item.id}>{item.name}</li>
        })
      }
    </div>
  )
}

